package com.ruoyi.common.oss.config;


import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssClientConfig {
    private final AliyunOssProperties aliyunOssProperties;

    public OssClientConfig(AliyunOssProperties aliyunOssProperties) {
        this.aliyunOssProperties = aliyunOssProperties;
    }

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder()
                .build(aliyunOssProperties.getEndpoint(),
                        aliyunOssProperties.getAccessKeyId(),
                        aliyunOssProperties.getAccessKeySecret());
    }
}
